package cn.monkey.state.core;

import java.util.function.Supplier;

public class SimpleStateGroupFactory implements StateGroupFactory {

    protected final Supplier<Long> timer;

    public SimpleStateGroupFactory(Supplier<Long> timer) {
        this.timer = timer;
    }


    @Override
    public StateGroup create(String id, Object... args) {
        StateGroup stateGroup = new SimpleStateGroup(id, StateContext.EMPTY, this.timer);
        State state = new EmptyState(stateGroup);
        stateGroup.addState(state);
        stateGroup.setStartState(EmptyState.CODE);
        return stateGroup;
    }
}
